<?php use_helper('Date') ?>
<?php use_helper('jQuery') ?>
<div id="paginaNoticias">
	<table height="500">
		<thead valign="top">
			<tr>
				<td colspan="2">Noticias</td>
			</tr>
		</thead>
		<tbody valign="top">
		<?php foreach ($noticiaPager as $noticia): ?>
			<tr valign="top">
				<td>
					<a href="<?php echo url_for('principal/noticiaView').'?id='.$noticia->getId() ?>">
						<?php echo $noticia->getTitulo() ?>
					</a>
				</td>
				<td><?php echo format_datetime($noticia->getFecha(), 'P', 'es_AR') ?></td>
			</tr>
			<tr valign="top">
				<td colspan="2"><?php echo $noticia->getEncabezado() ?></td>
				<td><?php echo image_tag('/uploads/imagenes/'.$noticia->getFirstImagen(), array('width' => 100)) ?></td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
	
	<?php if ($noticiaPager->haveToPaginate()): ?>
	<div class="pagination">
		<?php echo jq_link_to_remote('<<', array(
			'update' => 'paginaNoticias',
			'url' => 'principal/cambiarPaginaNoticia?noticiaPage=1'))?>
		<?php echo jq_link_to_remote('<', array(
			'update' => 'paginaNoticias',
			'url' => 'principal/cambiarPaginaNoticia?noticiaPage='.$noticiaPager->getPreviousPage()))?>
		<?php foreach ($noticiaPager->getLinks() as $page): ?>
			<?php if ($page == $noticiaPager->getPage()): ?>
				<?php echo $page ?>
			<?php else: ?>
				<?php echo jq_link_to_remote($page, array(
					'update' => 'paginaNoticias',
					'url' => 'principal/cambiarPaginaNoticia?noticiaPage='.$page))?>
			<?php endif; ?>
		<?php endforeach; ?>
		<?php echo jq_link_to_remote('>', array(
			'update' => 'paginaNoticias',
			'url' => 'principal/cambiarPaginaNoticia?noticiaPage='.$noticiaPager->getLastPage()))?>
		<?php echo jq_link_to_remote('>>', array(
			'update' => 'paginaNoticias',
			'url' => 'principal/cambiarPaginaNoticia?noticiaPage='.$noticiaPager->getNextPage()))?>
	</div>
	<?php endif; ?>
	<div class="pagination_desc">
		<strong><?php echo $noticiaPager->getNbResults() ?></strong>
		Noticias en total
		<?php if ($noticiaPager->haveToPaginate()): ?>
			- página <strong><?php echo $noticiaPager->getPage() ?>/<?php echo $noticiaPager->getLastPage() ?></strong>
		<?php endif; ?>
	</div>
</div>